<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" ><%@page
	language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="webctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
<title>公共投诉处理 </title>	
<link rel="stylesheet" href="${webctx }/js/ext/resources/css/ext-all.css"
	type="text/css">
	<link rel="stylesheet" href="${webctx }/js/ext/resources/css/xtheme-gray.css" type="text/css">
<script language="JavaScript" src="${webctx }/js/ext/adapter/ext/ext-base.js"></script>
<script language="JavaScript" src="${webctx }/js/ext/js/ext-all.js"></script>
<script language="JavaScript"
	src="${webctx }/js/ext/resources/locale/ext-lang-zh_CN.js"></script>
<script type="text/javascript" src="${webctx }/js/extInterceptor.js"></script>
<link rel="stylesheet" href="${webctx }/images/dcfs/dcfs.css" type="text/css">
<script type="text/javascript">
//获取url参数	
	var url = location.search;
	var theRequest = new Object(); 
    if (url.indexOf("?") != -1) { 
       var str = url.substr(1); 
       strs = str.split("&"); 
       var tssbbh=strs[1].split("=")[1];
       var tsbh=strs[0].split("=")[1];
    } 
    var ists;
     var extAjax = Ext.Ajax;
     extAjax.request({
         url:"${webctx }/tscl_getDcfsTsclJbxxByPK.action",
         method: 'POST',
         params:{action:"3",'dcfsTsclJbxx.tsbh':tsbh },
         callback:function (object, bool, response) {
         	//alert(response.responseText);
         	if(response.responseText!=''){
         		Ext.getCmp("TS_BH").setValue(response.responseText.split(":'")[1].split("',")[0]);
         		Ext.getCmp("TS_CL_R").setValue(response.responseText.split(":'")[2].split("',")[0]);
         		Ext.getCmp("TS_CL_R_GH").setValue(response.responseText.split(":'")[3].split("',")[0]);
         		Ext.getCmp("TS_CL_SJ").setValue(response.responseText.split(":'")[4].split("',")[0]);
         		Ext.getCmp("XC_CL_JG").setValue(response.responseText.split(":'")[5].split("',")[0]);
         		Ext.getCmp("XC_MS").setValue(response.responseText.split(":'")[6].split("',")[0]);
         		ists=0;
         	}else{
         		ists=1;
         	}
         },
         failure: function (response) {
               Ext.Msg.alert("提示", "操作出现了异常！");
         }                                    
    });
function checkDate(dateStr){
		if(dateStr==""||dateStr==null){
			return false;
		}else{
			if(dateStr.indexOf("-")!=-1){
				var dateArr=dateStr.split("-");
				var year=dateArr[0];
				var month=dateArr[1];
				var day=dateArr[2];
				if(isNaN(year)||year<=0){
					return false;
				}
				if(isNaN(month)||month<=0||month>12){
					return false;
				}
				if(isNaN(day)||day<=0||day>31){
					return false;
				}
				if((year%4==0&&year%100!=0)||(year%400==0)){
					if(month==2){
						if(day>29){
							return false;
						}
					}
				}else{
						if(month==2){
							if(day>28){
								return false;
							}
						}
					}
				var m1=new Array(1,3,5,7,8,10,12);
				for(var i=0;i<m1.length;i++){
					if(parseInt(month)==m1[i]){
						if(day>31){
							return false;
						}
					}
				}
				var m2=new Array(4,6,9,11);
				for(var j=0;j<m2.length;j++){
					if(parseInt(month)==m2[j]){
						if(day>30){
							return false;
						}
					}
				}
			}else{
				return false;
			}
		}
		return true;
	}
	
	function check(){
		var mydate=document.getElementById("TS_CL_SJ");
		if(checkDate(mydate.value)){
			document.getElementById("bc_submit").submit();
		}else{
			if(mydate.value==""||mydate.value==null){
				alert("请输入日期！");
				mydate.focus();
				return;
			}
			mydate.focus();
			alert("您输入的日期格式不正确！");
		}
	}


Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget='side';

var ts_fj_win=new Ext.Window({
	id: "ts_fj_win",   
	title:"附件添加",
	width: 550,
	height:350,
	collapsible: true, 
	layout:'fit',  
	collapsible: false,
	closeAction: "hide",
	modal: true,   
	action:'add',
	items:[     
		{
			xtype:'form',
			id:"ts_fj_form",
			border: false,
			frame:false,
			defaultType:"textfield",
			bodyStyle:'padding:10px 5px 0 13px',
			defaults:{anchor: "93%",border:false, blankText: "不能为空" },
			fileUpload: true,
			items:[
				{
					fieldLabel:"文档名称",
					name:"WD_MC",
					id:"WD_MC"
				},{
					xtype:"combo",
					fieldLabel:"文档类型",
					name:"WD_LX",
					id:"WD_LX",
					editable: false,
					triggerAction: 'all',
					store: new Ext.data.SimpleStore({
						fields: [{ name: "WD_LX" },{ name: "WD_LX"}],
						data: [
							['图片',"图片"],
							['视频',"视频"]
						]
					}),
					mode: 'local',
					valueField: 'WD_LX',
					displayField: 'WD_LX',
					selectOnFocus: true,
					emptyText: "请选择……"
				},{
					fieldLabel:"文档关键字",
					name:"WD_GJZ",
					id:"WD_GJZ"
				},{
					fieldLabel:"文档作者",
					name:"WD_ZZ",
					id:"WD_ZZ"
				},{
					fieldLabel:"上传文件",
					id:"userfile",
					inputType:"file",
					width:"200",
					anchor: "93%"
				},{
					xtype:"textarea",
					fieldLabel:"文档描述",
					name:"WD_MS",
					id:"WD_MS"
				}
			],
			buttons:[
				{
					text:"添加",
					id:"submit_btn",
					handler:function(){
						//if(Ext.getCmp("Win").action=="add")
						// {
						Ext.getCmp("ts_fj_form").getForm().submit({
							waitMsg : '正在提交表单数据,请稍候...',
							waitTitle : '正在验证数据...',
							method:"POST",
							//enctype:"mnltipart/form-data",
							url:"Fileupload_Servlet?active=add&TS_BH="+Ext.getCmp("TS_BH").getValue()+"&WD_MC="+Ext.getCmp('WD_MC').getValue()+"&WD_LX="+Ext.getCmp('WD_LX').getValue()+"&WD_GJZ="+Ext.getCmp('WD_GJZ').getValue()+"&WD_ZZ="+Ext.getCmp('WD_ZZ').getValue()+"&WD_MS="+Ext.getCmp('WD_MS').getValue(),
							params:{active:"add"},
							success:function(form,Retaction){
								Ext.Msg.hide();
								Ext.getCmp("ts_fj_grid").getStore().load({params:{ts_fj:1,active:"sreach",TS_BH:Ext.getCmp("TS_BH").getValue()}});
								Ext.getCmp("ts_fj_form").getForm().reset();
								ts_fj_win.hide();
							},
							failure:function(form,Retaction){
								Ext.Msg.alert("提示","操作出现了异常！");
							}
						});
					}
				}
			]
		}
	]
});



var ts_sj_win=new Ext.Window({
	id: "ts_sj_win",   
	title:"添加推算数据",
	width: 550,
	height:300,
	collapsible: true, 
	layout:'fit',  
	collapsible: false,
	closeAction: "hide",
	modal: true,   
	action:'add',
	items:[     
		{
			xtype:'form',
			id:"ts_sj_form",
			border: false,
			frame:false,
			defaultType:"textfield",
			bodyStyle:'padding:10px 5px 0 13px',
			defaults:{anchor: "93%",border:false, blankText: "不能为空" },
			items:[
				{
					fieldLabel:"编号",
					name:"dcfsTsclTsjcsjJbxx.jcdbm",
					id:"JCD_BM"
				},{
					fieldLabel:"名称",
					name:"dcfsTsclTsjcsjJbxx.jcdmc",
					id:"JCD_MC"
				},{
					fieldLabel:"方位",
					name:"dcfsTsclTsjcsjJbxx.jcdxdfw",
					id:"JCD_XDFW"
				},{
					xtype: "numberfield",
					fieldLabel:"水平距离",
					name:"dcfsTsclTsjcsjJbxx.jcdxdjlsp",
					allowBlank:false,
				 	id:"JCD_XDJL_SP"
				},{
					xtype: "numberfield",
					fieldLabel:"垂直距离",
					name:"dcfsTsclTsjcsjJbxx.jcdxdjlcz",
					allowBlank:false,
					id:"JCD_XDJL_CZ"
				},{
					xtype: "numberfield",
					fieldLabel:"损耗值",
					name:"dcfsTsclTsjcsjJbxx.jcdglshgl",
					allowBlank:false,
					id:"JCD_GLSH_GL"
				}, {
					xtype:"hidden",
					name:"dcfsTsclTsjcsjJbxx.tsbh",
					id:"TS_BH"
				},{
                    xtype:"panel",
                    html: '<span><h1>计算公式：Pd=P x G / (4 x π x r²)</br>Pd-功率密度（μW/cm2）&nbsp;&nbsp;&nbsp; P-天线发射功率（W）</br>G-天线增益（为倍数）&nbsp;&nbsp;&nbsp;r-天线与预测点之间的轴向距离（m）</h1></span>'
                }
			],
			buttons:[
				{
					text:"添加",
					id:"submit_btn",
					handler:function(){
						Ext.getCmp("TS_BH").setValue(tsbh);
						Ext.getCmp("ts_sj_form").getForm().submit({
							waitMsg : '正在提交表单数据,请稍候...',
							waitTitle : '正在验证数据...',
							method:"POST",
							url:"${webctx }/tssj_insertDcfsTsclTsjcsjJbxx.action",
							params:{ts_sj:1,active:0,'dcfsJzSbJbxx.jzsbbh':tssbbh},
							success:function(form,Retaction){
								Ext.Msg.hide();
								Ext.getCmp("ts_jcsj_ts_grid").getStore().load({params:{ts_sj:1,active:4,SB_BH:tssbbh,"dcfsTsclTsjcsjJbxx.tsbh":tsbh}});
								Ext.getCmp("ts_sj_form").getForm().reset();
								ts_sj_win.hide();
							},
							failure:function(form,Retaction){
								Ext.Msg.alert("提示","操作出现了异常！");
							}
						});
					}
				}
			]
		}
	]
});

var sm = new Ext.grid.CheckboxSelectionModel();
var sm_ts = new Ext.grid.CheckboxSelectionModel();
Ext.onReady(function(){
	var viewport=new Ext.Viewport({
		layout:"fit",
		items:[
			{
				xtype:"tabpanel",
				activeTab:0,
				tbar:["->",
					{
						text:"返回",
						handler:function(){
							location.href="${webctx }/dcfs_ggts/dcfs_ggts_jbxx.jsp";
						}
					}
				],
				items:[
					{
						title:"基本信息",
						layout:"fit",
						border:false,
								items:[
									{
										title:'投诉处理信息',
					            		xtype:'form',
					            		id:'txcl_form',
					            		border:false,
					            		frame:true,
					            		defaults:{anchor: "98%",border:false, blankText: "不能为空" },
					            		flex:1,
					            		items:[
					            			{
								                xtype : 'textfield',
								                name : 'dcfsTsclJbxx.tsbh',
								                fieldLabel: '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;投诉编号',
								                id:'TS_BH',
								                value:tsbh,
								                readOnly:true,
								                allowBlank:false
								            },{
						                        xtype: "combo",
										        name: "dcfsTsclJbxx.tsclr",
										        id: "TS_CL_R",
										        editable: false,
										        triggerAction: 'all',
										        fieldLabel: "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;处理人",
										        store: new Ext.data.SimpleStore({
										            fields: [{ name: "TS_CL_R_GH" },{ name: "TS_CL_R" }],
										            data: [
										                [1,"王刚"],
										                [2,"李强"]
										            ]
										        }),
										        mode: 'local',
										        valueField: 'TS_CL_R_GH',
										        displayField: 'TS_CL_R',
										        selectOnFocus: true,
										        tabIndex:21,
										        allowBlank:false,
										        value:'',
										        emptyText: "请选择……",
										        listeners:{
							                    	"select":function(){
							                    		Ext.getCmp("TS_CL_R_GH").setValue(Ext.getCmp("TS_CL_R").getValue());
							                    	}
							                    }
								            },{
								            	xtype:"datefield",
								                name : 'dcfsTsclJbxx.tsclsj',
								                fieldLabel: '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;处理时间',
								                id:'TS_CL_SJ',
								                editable: false,
								                format: 'Y-m-d',
						                        value:new Date()
								            },{
								                xtype : 'textarea',
								                name : 'dcfsTsclJbxx.xcms',
												height:'110',
								                fieldLabel: '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;现场状况',
								                value:'',
								                id:'XC_MS'
								            },{
								                xtype : 'textarea',
								                name : 'dcfsTsclJbxx.xccljg',
								                height:'110',
								                fieldLabel: '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;处理结果',
								                value:'',
								                id:'XC_CL_JG'
								            },{
								                xtype:'hidden',
								                id:'TS_CL_R_GH',
								                name:'dcfsTsclJbxx.tsclrgh'
								            }
					            		],
					            		buttons:[
					            			{
					            				text:'保存',
					            				id:"bc_submit",
					            				handler:function(){
					            					if(Ext.getCmp("txcl_form").getForm().isValid() == true){
					            						Ext.getCmp("txcl_form").getForm().submit({
								                            waitMsg : '正在提交表单数据,请稍候...',
								    						waitTitle : '正在验证数据...',
					            							method:"POST",
								                            url:"${webctx }/tscl_insertDcfsTsclJbxx.action",
								                            params : { active: 0,ists:ists },
								                            success:function(form,action){
								                            	Ext.Msg.hide();
								                            },
								                            failure:function(form,action){
								                                Ext.Msg.alert("提示","操作出现了异常！");
								                            }
					            						});
					            					}
					            				}
					            			},{
					            				text:'处理信息报表',
					            				handler:function(){
					            					location.href="${webctx }/dcfs_ggts/dcfs_ggts_ts_bb.jsp?dcfsJzSbJbxx.jzsbbh="+tssbbh+"&dcfsTsclJbxx.tsbh="+tsbh;
					            				}
					            			},{
					            				text:'基站信息',
					            				handler:function(){
					            					location.href="${webctx }/dcfs_ggts/dcfs_ggts_jz_jbqk.jsp?dcfsJzSbJbxx.jzsbbh="+tssbbh+"&dcfsTsclJbxx.tsbh="+tsbh;
					            				}
					            			},{
					            				text:'监测数据信息',
					            				handler:function(){
					            					location.href="${webctx }/dcfs_ggts/dcfs_ggts_jcjg.jsp?dcfsJzSbJbxx.jzsbbh="+tssbbh+"&dcfsTsclJbxx.tsbh="+tsbh;
					            				}
					            			}
					            		]
									}
									/*,{
										xtype:"grid",
										id:"ts_fj_grid",
										title:"相关附件",
										flex:1.6,
										loadMask: true,
										listeners:{
											"afterrender":function(){
												
											}
										},
										store: {
						                    xtype: "jsonstore",
						                    url:"DO_DCFS_TSCL_TSJCSJ_JBXX",
						                    root:"DCFS_TSCL_FJ_JBXX",
						                    //totalProperty: 'totalCount',
						                    fields: [
						                    	{name:"WD_MC"},{name:"WD_LX"},{name:"WD_GJZ"},{name:"WD_ZZ"},{name:"userfile"},{name:"WD_MS"},{name:"CONTENTID"}
						                   	]
						                },
						                sm:sm,
										columns:[sm,
											{header: '文档名称',width:210, dataIndex: 'WD_MC', align: "left" },
											{header: '类型',width:150, dataIndex: 'WD_LX', align: "left" },
											{header: '作者',width:200, dataIndex: 'WD_ZZ', align: "left" },
											{header: '文档描述 ',width:600, dataIndex: 'WD_MS', align: "left" }
										],
										tbar:["->",
											{
												text:"添加",
												iconCls: "icon-add",
												handler:function(){
													ts_fj_win.show();
												}
											},{
												text:"删除",
												iconCls: "icon-delete",
												handler:function(){
													if (Ext.getCmp("ts_fj_grid").getSelectionModel().getCount() > 0) {
							                            Ext.MessageBox.confirm('提示', '数据删除后不可还原,是否删除?', function (btn) {
							                                if (btn != "no") {
							                                    var sbytList = "";
							                                    for (var i = 0; i < Ext.getCmp("ts_fj_grid").getSelectionModel().getSelections().length; i++) {
							                                        sbytList += Ext.getCmp("ts_fj_grid").getSelectionModel().getSelections()[i].get("CONTENTID");
							                                        if (i < Ext.getCmp("ts_fj_grid").getSelectionModel().getSelections().length - 1) {
							                                            sbytList += ",";
							                                        }
							                                    }
							                                    Ext.Msg.wait('处理中，请稍后...', '提示'); //进度条等待
							                                    var extAjax = Ext.Ajax;
							                                    extAjax.request({
							                                        url:"DO_DCFS_TSCL_TSJCSJ_JBXX",
							                                        method: 'POST',
							                                        params:{ts_fj:1,active:"delete",lst:sbytList},
							                                        callback: function (object, bool, response) {
							                                        	Ext.Msg.hide();
							                                            Ext.getCmp("ts_fj_grid").getStore().load({params:{ts_fj:1,active:"sreach",TS_BH:Ext.getCmp("TS_BH").getValue()}});
							                                        },
							                                        failure: function (response) {
							                                            Ext.Msg.alert("提示", "操作失败");
							                                        }
							                                    });
							                                }
							                            });
							                        }
							                        else if (Ext.getCmp("ts_fj_grid").getSelectionModel().getCount() == 0) {
							                            Ext.Msg.alert("提示", "请最少选择一条记录");
							                        }
												}
											}
										]
									}*/
								]
					},{
						title:"监测数据分析",
						layout:"fit",
						items:[
							{
								layout:{
									type:'vbox',
									align:'stretch'     
								},
								defaults:{margins:'3 3 3 3'},
								items:[
									{
										xtype:"grid",
										id:"ts_jcsj_hs_grid",
										title:"监测数据",
										flex:1,
										loadMask: true,
										listeners:{
											"afterrender":function(){
												
											}
										},
										store: {
						                    xtype: "jsonstore",
						                    url:"${webctx }/jcsj_getDcfsHjjcdJbxxByCond_time.action",
						                    root:"DCFS_HS_EMSTIME_View",
						                    //totalProperty: 'totalCount',
						                    fields: [
						                    	{name:"JKXT_MN"},{name:"Datatime"},{name:"Avalue"},{name:"JCD_BM"},{name:"JCD_MC"},
						                    	{name:"JCLB_MC"},{name:"JCD_XDFW"},{name:"JCD_XDJL_SP"},{name:"JCD_XDJL_CZ"},{name:"JCD_DCQD"},{name:"JCD_GLMD"}
						                   	]
						                },
										columns:[
											{header: '监测点编号',width:210, dataIndex: 'JCD_BM', align: "left" },
											{header: '名称',width:150, dataIndex: 'JCD_MC', align: "left" },
											{header: '相对方位',width:200, dataIndex: 'JCD_XDFW', align: "left" },
											{header: '水平距离(m) ',width:200, dataIndex: 'JCD_XDJL_SP', align: "left" },
											{header: '垂直距离(m) ',width:200, dataIndex: 'JCD_XDJL_CZ', align: "left" },
											{header: '电场强度E(V/m)',width:300, dataIndex: 'JCD_DCQD', align: "left" },
											{header: '功率密度Pd(μW/cm2)',width:200, dataIndex: 'JCD_GLMD', align: "left" }
										]									
									},{
										xtype:"grid",
										id:"ts_jcsj_ts_grid",
										title:"推测数据",
										flex:1,
										loadMask: true,
										listeners:{
											"afterrender":function(){
												
											}
										},
										store: {
						                    xtype: "jsonstore",
						                    url:"${webctx }/tssj_getDcfsTsclTsjcsjJbxxListByCond.action",
						                    root:"DCFS_GBDS_SB_JBXX",
						                    //totalProperty: 'totalCount',
						                    fields: [
						                    	{name:"TS_BH"},{name:"JCD_BM"},{name:"JCD_MC"},{name:"JCD_XDFW"},{name:"JCD_XDJL_SP"},
						                    	{name:"JCD_XDJL_CZ"},{name:"JCD_GLSH_GL"},{name:"Avalue"},{name:"CValue"}
						                   	]
						                },
						                sm:sm_ts,
										columns:[sm_ts,
											{header: '编号',width:210, dataIndex: 'JCD_BM', align: "left" },
											{header: '名称',width:350, dataIndex: 'JCD_MC', align: "left" },
											{header: '相对方位',width:200, dataIndex: 'JCD_XDFW', align: "left" },
											{header: '水平距离(m)',width:210, dataIndex: 'JCD_XDJL_SP', align: "right" },
											{header: '垂直距离(m)',width:150, dataIndex: 'JCD_XDJL_CZ', align: "right" },
											{header: '实际值(μW/cm2)',width:210, dataIndex: 'Avalue', align: "right" },
											{header: '折算值(μW/cm2)',width:150, dataIndex: 'CValue', align: "right" }
										],
										tbar:["->",
											{
												text:"添加",
												iconCls: "icon-add",
												handler:function(){
													ts_sj_win.show();
												}
											},{
												text:"删除",
												iconCls: "icon-delete",
												handler:function(){
													if (Ext.getCmp("ts_jcsj_ts_grid").getSelectionModel().getCount() > 0) {
							                            Ext.MessageBox.confirm('提示', '数据删除后不可还原,是否删除?', function (btn) {
							                                if (btn != "no") {
							                                    var sbytList = "";
							                                    for (var i = 0; i < Ext.getCmp("ts_jcsj_ts_grid").getSelectionModel().getSelections().length; i++) {
								                                    var extAjax = Ext.Ajax;
								                                    Ext.Msg.wait("提示","正在删除",{text:"正在删除数据..."});
								                                    extAjax.request({
								                                        url:"${webctx }/tssj_deleteDcfsTsclTsjcsjJbxxByCond.action",
								                                        method: 'POST',
								                                        params:{ts_sj:1,active:1,'dcfsTsclTsjcsjJbxx.jcdbm':Ext.getCmp("ts_jcsj_ts_grid").getSelectionModel().getSelections()[i].get("JCD_BM"),'dcfsTsclTsjcsjJbxx.tsbh':tsbh},
								                                        callback: function (object, bool, response) {
								                                        	Ext.Msg.hide();
								                                        	Ext.getCmp("ts_jcsj_ts_grid").getStore().load({params:{ts_sj:1,active:4,SB_BH:tssbbh,"dcfsTsclTsjcsjJbxx.tsbh":tsbh}});
								                                        },
								                                        failure: function (response) {
								                                            Ext.Msg.alert("提示", "操作出现了异常！");
								                                        }
								                                    });
							                                    }
							                                }
							                            });
							                        }
							                        else if (Ext.getCmp("ts_jcsj_ts_grid").getSelectionModel().getCount() == 0) {
							                            Ext.Msg.alert("提示", "请最少选择一条记录");
							                        }
												}
											}
										]
									}
								]
							}
						]
					}
				]
			}
		]
	});
	//Ext.getCmp("ts_fj_grid").getStore().load({params:{ts_fj:1,active:"sreach",TS_BH:Ext.getCmp("TS_BH").getValue()}});
	Ext.getCmp("ts_jcsj_ts_grid").getStore().load({params:{ts_sj:1,active:4,'dcfsTsclTsjcsjJbxx.tsbh':tsbh}});
	Ext.getCmp("ts_jcsj_hs_grid").getStore().load({params:{hs_sj:1,active:"sreach",'dcfsHjjcdJbxx.jzsbbh':tssbbh}});
});
</script>
</head>
<body>
</body>
</html>